<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page   import= "java.util.Vector"%>
<%@ page   import= "com.example.sec.data.UserInfo"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> 
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
 
<html> 
	<head>
		<title>Show user info page</title>
	</head>
	<body>
		<% String   id = (String)request.getAttribute("ID");%>
		<% String   userName = (String)request.getAttribute("userName");%>
		<% String   password = (String)request.getAttribute("password");%>
		<% String   firstName = (String)request.getAttribute("firstName");%>
		<% String   lastName = (String)request.getAttribute("lastName");%>
		<% String   phoneNumber = (String)request.getAttribute("phoneNumber");%>
		<% String   address = (String)request.getAttribute("address");%>
		<% String   email = (String)request.getAttribute("email");%>
		<% Vector   userList = (Vector)request.getAttribute("userList");%>

		<html:form action="/userInfoShow"> 
		<table width="100%">		
				<tr valign="top">
					<td width="1%">&nbsp;</td>
					<td width="32%" align="right" nowrap="nowrap">User name:</td>
					<td colspan="2" width="67%">
						<html:text property="userName" value="<%=userName%>" readonly="true" /><html:errors property="userName"/>
					</td>
				</tr>
				
				<tr valign="top">
					<td width="1%">&nbsp;</td>
					<td width="32%" align="right" nowrap="nowrap">Email:</td>
					<td colspan="2" width="67%">
						<html:text property="email" value="<%=email%>"  readonly="true"/><html:errors property="email"/>
					</td>
				</tr>
				
				<tr valign="top">
					<td width="1%">&nbsp;</td>
					<td width="32%" align="right" nowrap="nowrap">Password:</td>
					<td colspan="2" width="67%">
						<html:password property="password" value="" readonly="true" /><html:errors property="password"/>
					</td>
				</tr>
				
				<tr valign="top">
					<td width="1%">&nbsp;</td>
					<td width="32%" align="right" nowrap="nowrap">First Name:</td>
					<td colspan="2" width="67%">
						<html:text property="firstName" value="<%=firstName%>" readonly="true"/><html:errors property="firstName"/>
					</td>
				</tr>
				
				<tr valign="top">
					<td width="1%">&nbsp;</td>
					<td width="32%" align="right" nowrap="nowrap">Last Name:</td>
					<td colspan="2" width="67%">
						<html:text property="lastName" value="<%=lastName%>" readonly="true"/><html:errors property="lastName"/>
					</td>
				</tr>
				
				<tr valign="top">
					<td width="1%">&nbsp;</td>
					<td width="32%" align="right" nowrap="nowrap">Address:</td>
					<td colspan="2" width="67%">
						<html:text property="address" value="<%=address%>"  readonly="true"/><html:errors property="address"/>
					</td>
				</tr>
				
				<tr valign="top">
					<td width="1%">&nbsp;</td>
					<td width="32%" align="right" nowrap="nowrap">Phone Number:</td>
					<td colspan="2" width="67%">
						<html:text property="phoneNumber" value="<%=phoneNumber%>"  readonly="true"/><html:errors property="phoneNumber"/>
					</td>
				</tr>
				
				
				
				<tr valign="top">
					<td width="1%">&nbsp;</td>
					<td width="32%" align="right" nowrap="nowrap"></td>
					<td colspan="2" width="67%">
						<input value="Edit" name="btnEdit" type="submit"><html:cancel value="Sign Out"/>
					</td>
				</tr>
				
				<tr valign="top">
					<td width="1%">&nbsp;</td>
					<td width="32%" align="right" nowrap="nowrap"></td>
					<td colspan="2" width="67%">
						<html:hidden property="id" value="<%=id%>" /> <html:errors property="id"/>
					</td>
				</tr>
				
			</table>
			<% 
				if (userList != null && !userList.isEmpty()){ 
					int count = userList.size();
					if (count > 0) {
			%>
			<table width="100%" style="BORDER-RIGHT: #0000ff 4px ridge; BORDER-TOP: #0000ff 2px ridge; BORDER-LEFT: #0000ff 2px ridge; BORDER-BOTTOM: #0000ff 2px ridge">
				<tr valign="top">
					<td width="0%" style= "display:none " >&nbsp;</td>
					<td width="10%" align="left" style= "border-left:1px   solid   #111111;border-bottom:1px   solid   #111111;border-right:1px   solid   #111111;border-top:1px   solid   #111111">User Name</td>
					<td width="15%" align="left" style= "border-left:1px   solid   #111111;border-bottom:1px   solid   #111111;border-right:1px   solid   #111111;border-top:1px   solid   #111111">First Name</td>
					<td width="15%" align="left" style= "border-left:1px   solid   #111111;border-bottom:1px   solid   #111111;border-right:1px   solid   #111111;border-top:1px   solid   #111111">Last Name</td>
					<td width="20%" align="left" style= "border-left:1px   solid   #111111;border-bottom:1px   solid   #111111;border-right:1px   solid   #111111;border-top:1px   solid   #111111">Email</td>
					<td width="15%" align="left" style= "border-left:1px   solid   #111111;border-bottom:1px   solid   #111111;border-right:1px   solid   #111111;border-top:1px   solid   #111111">Phone</td>
					<td width="25%" align="left" style= "border-left:1px   solid   #111111;border-bottom:1px   solid   #111111;border-right:1px   solid   #111111;border-top:1px   solid   #111111">Address</td>
				</tr>
			<% 
					for (int i =0; i < count; i++){
						UserInfo userInfo = (UserInfo)userList.get(i);
			%>
			
				<tr valign="top">
					<td width="0%" style= "display:none"><%=userInfo.getId()%></td>
					<td width="10%" align="left" style= "border-left:1px   solid   #111111;border-bottom:1px   solid   #111111;border-right:1px   solid   #111111;border-top:1px   solid   #111111"><%=userInfo.getUserName()%></td>
					<td width="15%" align="left" style= "border-left:1px   solid   #111111;border-bottom:1px   solid   #111111;border-right:1px   solid   #111111;border-top:1px   solid   #111111"><%=userInfo.getFirstName()%></td>
					<td width="15%" align="left" style= "border-left:1px   solid   #111111;border-bottom:1px   solid   #111111;border-right:1px   solid   #111111;border-top:1px   solid   #111111"><%=userInfo.getLastName()%></td>
					<td width="20%" align="left" style= "border-left:1px   solid   #111111;border-bottom:1px   solid   #111111;border-right:1px   solid   #111111;border-top:1px   solid   #111111"><%=userInfo.getEmail()%></td>
					<td width="15%" align="left" style= "border-left:1px   solid   #111111;border-bottom:1px   solid   #111111;border-right:1px   solid   #111111;border-top:1px   solid   #111111"><%=userInfo.getPhoneNumber()%></td>
					<td width="25%" align="left" style= "border-left:1px   solid   #111111;border-bottom:1px   solid   #111111;border-right:1px   solid   #111111;border-top:1px   solid   #111111"><%=userInfo.getAddress()%></td>
				</tr>
			
			<% 			
					}
			%>
			
			</table>
			<% 		
				}
			} 
			%>
	</html:form>
	</body>
</html>

